/****** Object:  Stored Procedure dbo.CGO_GameSave    Script Date: Friday, March 04, 2011 ******/
IF EXISTS ( SELECT  *
            FROM    dbo.sysobjects
            WHERE   id = OBJECT_ID(N'dbo.CGO_GameSave')
                    AND OBJECTPROPERTY(id, N'IsProcedure') = 1 ) 
  DROP PROCEDURE dbo.CGO_GameSave
GO

/* -------------------------------------------------------------------------------------
/   GameAdd
/  ------------------------------------------------------------------------------------- */
SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

CREATE PROCEDURE dbo.CGO_GameSave
  @GameID INT,
  @PortalID INT ,
  @UserID INT ,
  @Status INT ,
  @Name NVARCHAR(100) ,
  @Description NTEXT ,
  @ImageURL NVARCHAR(100) ,
  @ImageType NVARCHAR(1) ,
  @ImageWidth INT ,
  @ImageHeight INT ,
  @GameTablID INT,
  @Category INT ,
  @ImageDisplay BIT  
AS 
  IF @GameID IS NOT NULL
    AND @GameID > 0
    AND EXISTS ( SELECT 1
                 FROM   dbo.CGO_Game
                 WHERE  GameID = @GameID)
                        --AND PortalID = @PortalID ) 
    BEGIN
      UPDATE  dbo.CGO_Game
      SET     Name = @Name ,
              Description = @Description ,
              ImageURL = @ImageURL ,
              ImageType = @ImageType ,
              ImageWidth = @ImageWidth ,
              ImageHeight = @ImageHeight ,
              GameTabID = @GameTablID ,
              Status = @Status ,
              Category = @Category ,
              ImageDisplay = @ImageDisplay ,              
              LastUpdatedID = @UserID ,
              LastUpdateDate = GETDATE()
      WHERE   GameID = @GameID
      --AND PortalID = @PortalID
    END
  SELECT  @GameID
GO